package Q1;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();
        int len = str.length();

        int ret = 0;
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j < len + 1; j++) {
                String temp = str.substring(i, j);
                if (method(temp)) {
                    ret = Math.max(ret, j - i);
                }
            }
        }

        System.out.println(ret);
    }

    public static boolean method(String str) {
        int left = 0, right = str.length() - 1;
        while (left < right) {
            if (str.charAt(left) != str.charAt(right)) {
                return false;
            }
            left++;
            right--;
        }

        return true;
    }
}
